<!DOCTYPE HTML>
<html>
<!--_meta 作为公共模版分离出去-->
{include file="common/_meta"}
<!--/meta 作为公共模版分离出去-->
<link href="/static/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<body>
<!--_header 作为公共模版分离出去-->
{include file="common/_header"}
<!--/_header 作为公共模版分离出去-->
<!--_menu 作为公共模版分离出去-->
{include file="common/_menu"}
<!--/_menu 作为公共模版分离出去-->

<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 	
        <a href="{:url('index/index')}"> 首页</a> <span class="c-gray en">&gt;</span> 
        附件浏览器
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a> 
    </nav>
    <div class="page-container">
        <form class="form form-horizontal" id="form-article-add" method="POST" enctype="multipart/form-data">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">图片上传：</label>
                <div class="formControls col-xs-8 col-sm-9" id="updiv">
                    <input  type="file" class="btn radius" name="image[]" >
                    <button type="button" class="btn btn-primary radius" onClick="addfile()" >添加图片</button>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">是否生成缩略图：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <div class="radio-box">
                        <input name="isthumb" type="radio" id="sex-1" value="0" checked>
                        <label for="sex-1">不生成</label>
                    </div>
                    <div class="radio-box">
                        <input name="isthumb" type="radio" id="sex-2" value="1">
                        <label for="sex-2">生成</label>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button type="submit" class="btn btn-primary radius" ><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                    <button type="button" class="btn btn-default radius" onClick="window.history.go(-1);" >&nbsp;取&nbsp;&nbsp;消&nbsp;</button>
                </div>
            </div>
        </form>
    </div>
</section>
<!--_footer 作为公共模版分离出去-->
{include file="common/_footer" /}
<!--/_footer 作为公共模版分离出去-->
        
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

function addfile(){
    var file = "<br/>";
    file +=  '<input type="file" class="btn radius" name="image[]" >';
    file += '<button type="button" class="btn btn-default radius" onClick="delfile(this)" >取消</button>';
    $("#updiv").append(file);
}

function delfile(obj){
    $(obj).prev('input').remove();
    $(obj).prev('br').remove();
    $(obj).remove();
}

$("#form-article-add").submit(function(){
    var files = $("input[name='image[]'] ");
    // console.log(files);return false;
    var test = true;
    files.each(function(x) {
        if($(this).val()==''){
            // layer.msg("请选择要上传的文件",{time:1000});
            alert("请选择要上传的文件");
            test = false;
        }
    });
    return test;
})

</script>
<!--请在上方写此页面业务相关的脚本-->
</body>
</html>
